#ifndef _BARTER_SERVER_MUTEX_H_
#define _BARTER_SERVER_MUTEX_H_

#ifdef WIN32
#include <windows.h>
#else
#include <pthread.h>
#endif

class Mutex
{
private:
#ifdef WIN32
	HANDLE Handle;
#else
	pthread_mutex_t Handle;
#endif
	Mutex(const Mutex&); /* no copy ctor */
	Mutex& operator=(const Mutex&); /* no assign operator */
public:
	Mutex(); /* can make new mutex */
	~Mutex();
	void Lock();
	void Unlock();
};

/*
	Locks a mutex by scope
*/
class AutoLock
{
private:
	Mutex& Handle;
public:
	AutoLock(Mutex&);
	~AutoLock();
};

#endif // _BARTER_SERVER_MUTEX_H_
